<?php
/*
================== a表数据 =====================
mysql> select * from a;
	+-----+-----------+
	| aid | anum      |
	+-----+-----------+
	|   1 | a20050111 |
	|   2 | a20050112 |
	|   3 | a20050113 |
	|   4 | a20050114 |
	|   5 | a20050115 |
	+-----+-----------+
5 rows in set (0.00 sec)


=================== b表数据 ====================
mysql> select * from b;
	+-----+-------------+-------+
	| bid | bnum        | other |
	+-----+-------------+-------+
	|   1 |  2006032401 | one   |
	|   2 | 2006032402  | two   |
	|   3 | 2006032403  | three |
	|   4 | 2006032404  | four  |
	|   8 | 2006032408  | five  |
	+-----+-------------+-------+
	5 rows in set (0.00 sec)



1、INNER JOIN  ...  ON
	mysql> select * from a inner join b on a.aid=b.bid;
		+-----+-----------+-----+-------------+-------+
		| aid | anum      | bid | bnum        | other |
		+-----+-----------+-----+-------------+-------+
		|   1 | a20050111 |   1 |  2006032401 | one   |
		|   2 | a20050112 |   2 | 2006032402  | two   |
		|   3 | a20050113 |   3 | 2006032403  | three |
		|   4 | a20050114 |   4 | 2006032404  | four  |
		+-----+-----------+-----+-------------+-------+
		4 rows in set (0.00 sec)

2、LEFT JOIN ... ON
	mysql> select * from a left join b on a.aid=b.bid; 
		+-----+-----------+------+-------------+-------+
		| aid | anum      | bid  | bnum        | other |
		+-----+-----------+------+-------------+-------+
		|   1 | a20050111 |    1 |  2006032401 | one   |
		|   2 | a20050112 |    2 | 2006032402  | two   |
		|   3 | a20050113 |    3 | 2006032403  | three |
		|   4 | a20050114 |    4 | 2006032404  | four  |
		|   5 | a20050115 | NULL | NULL        | NULL  |
		+-----+-----------+------+-------------+-------+
		5 rows in set (0.00 sec)

3、RIGHT JOIN ... ON
	mysql> select * from a right join b on a.aid=b.bid;
		+------+-----------+-----+-------------+-------+
		| aid  | anum      | bid | bnum        | other |
		+------+-----------+-----+-------------+-------+
		|    1 | a20050111 |   1 |  2006032401 | one   |
		|    2 | a20050112 |   2 | 2006032402  | two   |
		|    3 | a20050113 |   3 | 2006032403  | three |
		|    4 | a20050114 |   4 | 2006032404  | four  |
		| NULL | NULL      |   8 | 2006032408  | five  |
		+------+-----------+-----+-------------+-------+
		5 rows in set (0.00 sec)








*/